home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3254 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  1.5 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 64 6e | 73 2e 70 6c 61 6e 6f 2e |Path: dn|s.plano.|
|00000010| 6e 65 74 21 6e 65 77 73 | 09 0a 46 72 6f 6d 3a 20 |net!news|..From: |
|00000020| 43 68 61 72 6c 65 73 20 | 52 69 63 68 6d 6f 6e 64 |Charles |Richmond|
|00000030| 20 3c 72 69 63 68 6d 6f | 6e 64 40 70 6c 61 6e 6f | <richmo|nd@plano|
|00000040| 2e 6e 65 74 3e 0a 4e 65 | 77 73 67 72 6f 75 70 73 |.net>.Ne|wsgroups|
|00000050| 3a 20 63 6f 6d 70 2e 6c | 61 6e 67 2e 63 0a 53 75 |: comp.l|ang.c.Su|
|00000060| 62 6a 65 63 74 3a 20 52 | 65 3a 20 52 65 74 75 72 |bject: R|e: Retur|
|00000070| 6e 69 6e 67 20 61 20 76 | 61 72 69 61 62 6c 65 20 |ning a v|ariable |
|00000080| 66 72 6f 6d 20 73 79 73 | 74 65 6d 28 29 20 66 75 |from sys|tem() fu|
|00000090| 6e 63 74 69 6f 6e 0a 44 | 61 74 65 3a 20 32 37 20 |nction.D|ate: 27 |
|000000a0| 4a 61 6e 20 31 39 39 36 | 20 30 38 3a 32 39 3a 34 |Jan 1996| 08:29:4|
|000000b0| 39 20 47 4d 54 0a 4f 72 | 67 61 6e 69 7a 61 74 69 |9 GMT.Or|ganizati|
|000000c0| 6f 6e 3a 20 43 61 6e 69 | 6e 65 20 43 6f 6d 70 75 |on: Cani|ne Compu|
|000000d0| 74 65 72 20 43 65 6e 74 | 65 72 0a 4d 65 73 73 61 |ter Cent|er.Messa|
|000000e0| 67 65 2d 49 44 3a 20 3c | 34 65 63 6e 70 74 24 6a |ge-ID: <|4ecnpt$j|
|000000f0| 6f 63 40 64 6e 73 2e 70 | 6c 61 6e 6f 2e 6e 65 74 |oc@dns.p|lano.net|
|00000100| 3e 0a 52 65 66 65 72 65 | 6e 63 65 73 3a 20 3c 32 |>.Refere|nces: <2|
|00000110| 39 35 33 33 36 36 39 34 | 77 6e 72 40 69 69 67 61 |95336694|wnr@iiga|
|00000120| 2e 64 65 6d 6f 6e 2e 63 | 6f 2e 75 6b 3e 0a 4e 4e |.demon.c|o.uk>.NN|
|00000130| 54 50 2d 50 6f 73 74 69 | 6e 67 2d 48 6f 73 74 3a |TP-Posti|ng-Host:|
|00000140| 20 61 75 78 35 30 2e 70 | 6c 61 6e 6f 2e 6e 65 74 | aux50.p|lano.net|
|00000150| 0a 4d 69 6d 65 2d 56 65 | 72 73 69 6f 6e 3a 20 31 |.Mime-Ve|rsion: 1|
|00000160| 2e 30 0a 43 6f 6e 74 65 | 6e 74 2d 54 79 70 65 3a |.0.Conte|nt-Type:|
|00000170| 20 74 65 78 74 2f 70 6c | 61 69 6e 3b 20 63 68 61 | text/pl|ain; cha|
|00000180| 72 73 65 74 3d 75 73 2d | 61 73 63 69 69 0a 43 6f |rset=us-|ascii.Co|
|00000190| 6e 74 65 6e 74 2d 54 72 | 61 6e 73 66 65 72 2d 45 |ntent-Tr|ansfer-E|
|000001a0| 6e 63 6f 64 69 6e 67 3a | 20 37 62 69 74 0a 58 2d |ncoding:| 7bit.X-|
|000001b0| 4d 61 69 6c 65 72 3a 20 | 4d 6f 7a 69 6c 6c 61 20 |Mailer: |Mozilla |
|000001c0| 31 2e 31 4e 20 28 4d 61 | 63 69 6e 74 6f 73 68 3b |1.1N (Ma|cintosh;|
|000001d0| 20 49 3b 20 36 38 4b 29 | 0a 54 6f 3a 20 70 65 74 | I; 68K)|.To: pet|
|000001e0| 65 40 69 69 67 61 2e 64 | 65 6d 6f 6e 2e 63 6f 2e |e@iiga.d|emon.co.|
|000001f0| 75 6b 0a 58 2d 55 52 4c | 3a 20 6e 65 77 73 3a 32 |uk.X-URL|: news:2|
|00000200| 39 35 33 33 36 36 39 34 | 77 6e 72 40 69 69 67 61 |95336694|wnr@iiga|
|00000210| 2e 64 65 6d 6f 6e 2e 63 | 6f 2e 75 6b 0a 0a 50 65 |.demon.c|o.uk..Pe|
|00000220| 74 65 20 52 79 61 6e 20 | 3c 70 65 74 65 40 69 69 |te Ryan |<pete@ii|
|00000230| 67 61 2e 64 65 6d 6f 6e | 2e 63 6f 2e 75 6b 3e 20 |ga.demon|.co.uk> |
|00000240| 77 72 6f 74 65 3a 0a 3e | 48 69 79 61 2c 0a 3e 09 |wrote:.>|Hiya,.>.|
|00000250| 49 60 76 65 20 6a 75 73 | 74 20 62 65 65 6e 20 65 |I`ve jus|t been e|
|00000260| 78 70 65 72 69 6d 65 6e | 74 69 6e 67 20 77 69 74 |xperimen|ting wit|
|00000270| 68 20 43 20 6f 6e 20 55 | 4e 49 58 20 61 6e 64 20 |h C on U|NIX and |
|00000280| 68 61 76 65 20 63 6f 6d | 65 20 61 63 72 6f 73 73 |have com|e across|
|00000290| 20 61 20 0a 3e 70 72 6f | 62 6c 65 6d 21 2e 20 20 | a .>pro|blem!. |
|000002a0| 54 68 65 72 65 20 69 73 | 20 61 20 55 4e 49 58 20 |There is| a UNIX |
|000002b0| 63 6f 6d 6d 61 6e 64 20 | 63 61 6c 6c 65 64 20 60 |command |called `|
|000002c0| 66 69 6e 64 20 2f 20 2d | 6e 61 6d 65 20 67 77 69 |find / -|name gwi|
|000002d0| 72 65 20 2d 70 72 69 6e | 74 60 20 0a 3e 77 68 69 |re -prin|t` .>whi|
|000002e0| 63 68 20 73 63 61 6e 73 | 20 74 68 65 20 55 4e 49 |ch scans| the UNI|
|000002f0| 58 20 64 72 69 76 65 20 | 66 6f 72 20 66 69 6c 65 |X drive |for file|
|00000300| 73 2f 64 69 72 65 63 74 | 6f 72 69 65 73 20 63 6f |s/direct|ories co|
|00000310| 6e 74 61 69 6e 69 6e 67 | 20 60 67 77 69 72 65 60 |ntaining| `gwire`|
|00000320| 2e 20 20 0a 3e 41 6e 79 | 77 61 79 20 77 68 61 74 |. .>Any|way what|
|00000330| 20 49 20 77 61 6e 74 20 | 74 6f 20 64 6f 20 69 73 | I want |to do is|
|00000340| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 2e 2e | the fol|lowing..|
|00000350| 2e 0a 3e 0a 54 68 65 20 | 73 79 73 74 65 6d 28 29 |..>.The |system()|
|00000360| 20 66 75 6e 63 74 69 6f | 6e 20 28 69 6e 20 55 6e | functio|n (in Un|
|00000370| 69 78 2c 20 61 74 20 6c | 65 61 73 74 29 20 72 65 |ix, at l|east) re|
|00000380| 74 75 72 6e 73 20 61 20 | 6f 6e 65 2d 62 79 74 65 |turns a |one-byte|
|00000390| 20 73 74 61 74 75 73 20 | 63 6f 64 65 20 0a 69 6e | status |code .in|
|000003a0| 64 69 63 61 74 69 6e 67 | 20 74 68 65 20 63 6f 6d |dicating| the com|
|000003b0| 70 6c 65 74 69 6f 6e 20 | 63 6f 64 65 20 6f 66 20 |pletion |code of |
|000003c0| 74 68 65 20 63 6f 6d 6d | 61 6e 64 20 65 78 65 63 |the comm|and exec|
|000003d0| 75 74 65 64 2e 20 43 68 | 65 63 6b 20 79 6f 75 72 |uted. Ch|eck your|
|000003e0| 20 6d 61 6e 20 0a 70 61 | 67 65 73 20 66 6f 72 20 | man .pa|ges for |
|000003f0| 61 20 66 75 6e 63 74 69 | 6f 6e 20 63 61 6c 6c 65 |a functi|on calle|
|00000400| 64 20 70 6f 70 65 6e 28 | 29 2e 20 49 74 20 77 69 |d popen(|). It wi|
|00000410| 6c 6c 20 6f 70 65 6e 20 | 61 20 70 69 70 65 2c 20 |ll open |a pipe, |
|00000420| 65 78 65 63 75 74 65 20 | 61 20 55 6e 69 78 20 0a |execute |a Unix .|
|00000430| 63 6f 6d 6d 61 6e 64 2c | 20 61 6e 64 20 6c 65 74 |command,| and let|
|00000440| 20 79 6f 75 20 72 65 61 | 64 20 74 68 65 20 72 65 | you rea|d the re|
|00000450| 73 75 6c 74 20 76 69 61 | 20 61 20 66 69 6c 65 20 |sult via| a file |
|00000460| 70 6f 69 6e 74 65 72 20 | 74 6f 20 74 68 65 20 70 |pointer |to the p|
|00000470| 69 70 65 20 28 6f 72 20 | 0a 77 72 69 74 65 20 6f |ipe (or |.write o|
|00000480| 75 74 70 75 74 20 74 6f | 20 74 68 65 20 63 6f 6d |utput to| the com|
|00000490| 6d 61 6e 64 20 76 69 61 | 20 74 68 65 20 66 69 6c |mand via| the fil|
|000004a0| 65 20 70 6f 69 6e 74 65 | 72 22 2e 20 54 68 65 20 |e pointe|r". The |
|000004b0| 73 79 6e 74 61 78 20 69 | 73 20 0a 73 6f 6d 65 74 |syntax i|s .somet|
|000004c0| 68 69 6e 67 20 6c 69 6b | 65 20 74 68 65 20 66 6f |hing lik|e the fo|
|000004d0| 6c 6c 6f 77 69 6e 67 3a | 0a 0a 20 20 20 20 20 46 |llowing:|.. F|
|000004e0| 49 4c 45 20 20 20 2a 66 | 70 3b 0a 20 20 20 20 20 |ILE *f|p;. |
|000004f0| 63 68 61 72 20 20 20 6c | 69 6e 5b 32 30 30 5d 3b |char l|in[200];|
|00000500| 0a 0a 0a 20 20 20 20 20 | 69 66 28 21 28 66 70 20 |... |if(!(fp |
|00000510| 3d 20 70 6f 70 65 6e 28 | 22 66 69 6e 64 20 2f 20 |= popen(|"find / |
|00000520| 2d 6e 61 6d 65 20 67 77 | 69 72 65 20 2d 70 72 69 |-name gw|ire -pri|
|00000530| 6e 74 22 2c 22 72 22 29 | 29 0a 20 20 20 20 20 20 |nt","r")|). |
|00000540| 20 7b 0a 20 20 20 20 20 | 20 20 20 20 66 70 72 69 | {. | fpri|
|00000550| 6e 74 66 28 73 74 64 65 | 72 72 2c 22 2d 2d 3e 20 |ntf(stde|rr,"--> |
|00000560| 45 72 72 6f 72 20 77 69 | 74 68 20 70 6f 70 65 6e |Error wi|th popen|
|00000570| 28 29 5c 6e 22 29 3b 0a | 20 20 20 20 20 20 20 20 |()\n");.| |
|00000580| 20 65 78 69 74 28 2d 31 | 29 3b 0a 20 20 20 20 20 | exit(-1|);. |
|00000590| 20 20 7d 0a 0a 20 20 20 | 20 20 66 67 65 74 73 28 | }.. | fgets(|
|000005a0| 6c 69 6e 2c 73 69 7a 65 | 6f 66 28 6c 69 6e 29 2c |lin,size|of(lin),|
|000005b0| 66 70 29 3b 0a 0a 4c 6f | 6f 70 20 77 69 74 68 20 |fp);..Lo|op with |
|000005c0| 74 68 65 20 66 67 65 74 | 73 20 74 6f 20 72 65 61 |the fget|s to rea|
|000005d0| 64 20 61 6c 6c 20 74 68 | 65 20 72 65 73 75 6c 74 |d all th|e result|
|000005e0| 73 2e 20 57 68 65 6e 20 | 66 67 65 74 73 28 29 20 |s. When |fgets() |
|000005f0| 72 65 74 75 72 6e 73 20 | 4e 55 4c 4c 2c 20 0a 74 |returns |NULL, .t|
|00000600| 68 65 72 65 20 61 72 65 | 20 2a 6e 6f 2a 20 6d 6f |here are| *no* mo|
|00000610| 72 65 20 72 65 73 75 6c | 74 73 20 74 6f 20 67 65 |re resul|ts to ge|
|00000620| 74 2e 0a 0a 0a | |t.... | |
+--------+-------------------------+-------------------------+--------+--------+